home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg4.cab / test_xmllib.py < prev    next >
Text File  |  2005-11-19  |  908b  |  38 lines

  1. '''Test module to thest the xmllib module.
  2.    Sjoerd Mullender
  3. '''
  4.  
  5. testdoc = """\
  6. <?xml version="1.0" encoding="UTF-8" standalone='yes' ?>
  7. <!-- comments aren't allowed before the <?xml?> tag,
  8.      but they are allowed before the <!DOCTYPE> tag -->
  9. <?processing instructions are allowed in the same places as comments ?>
  10. <!DOCTYPE greeting [
  11.   <!ELEMENT greeting (#PCDATA)>
  12. ]>
  13. <greeting>Hello, world!</greeting>
  14. """
  15.  
  16. import warnings
  17. warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*",
  18.                         DeprecationWarning, r'xmllib$')
  19.  
  20. from test import test_support
  21. import unittest
  22. import xmllib
  23.  
  24. class XMLParserTestCase(unittest.TestCase):
  25.  
  26.     def test_simple(self):
  27.         parser = xmllib.XMLParser()
  28.         for c in testdoc:
  29.             parser.feed(c)
  30.         parser.close()
  31.  
  32.  
  33. def test_main():
  34.     test_support.run_unittest(XMLParserTestCase)
  35.  
  36. if __name__ == "__main__":
  37.     test_main()
  38.